As computer architectures evolve, new instructions and other features are added to them. Newer computers and the software (programs) written for them are able to use these newer instructions and features to achieve advantages not available to older computers of the same architecture. It is thus desirable for newer programs, or newer versions of programs, to use new instructions. However, it is also generally desirable that newer programs be executable on older computers as well as on newer ones, i.e., that they be backwards compatible. The software vendor can sell programs to customers having a range of versions of hardware, yet need support only one version of each such program. Customers can buy one version of a program, and it will run on their hardware regardless of which version the hardware is. And customers who desire to use the program in a so-called "heterogeneous" environment, i.e., a computer cluster or collection consisting of both older and newer computers that all need the ability to run the program, need install and maintain only a single version of the program. Thus a general goal of computer designers is promoting use of new instructions, which improves computer system performance, while at the same time providing backwards compatibility so that a new or updated program will be widely usable.
One way this general goal has been approached in the past may be referred to as "trap and emulate". In this scheme, the executable program is compiled using one or more new instructions, and an updated operating system software module is provided for use on computers on which the executable program is to be executed. When an older computer attempts to execute a new instruction, an illegal instruction trap occurs by design of the central processor. The trap vector points to the updated operating system module, referred to as a trap handler. The trap handler examines the illegal instruction, and determines that it is a newer instruction that will correctly execute only on a newer computer. It then launches a routine that emulates the new instruction in software. On completion of the emulation routine, program control is returned to the executable program at the instruction following the new instruction.
The "trap and emulate" solution described above suffers from drawbacks that make it unattractive. One drawback is the requirement that the operating system be updated whenever new instructions are added to the architecture and used in executable programs. Another significant drawback is performance. There is a large penalty, on the order of a hundred processor clock cycles, for taking a trap. In fact, the performance on the older computer is generally worse than that of the original program that lacked the newer instructions. The trap-and-emulate solution, therefore, does not adequately address the desire to maintain high performance on the older computers while achieving backwards compatibility.